#ifndef _ADDER_H_
#define _ADDER_H_

#include "EventProcessor.h"
#include "EventProcessorImp.h"
#include "Message.h"

/** the class adds numbers received from generators When die message is received
    it prints the result 
*/

class AdderImp : public EventProcessorImp {
 private:
  long int sum; // the total sum the adder maintains
  
 public:
  AdderImp(void);

  // message handling funciton for the numbers
  MESSAGE_HANDLER_DECLARATION(AddMe);

  // new handler for the die message to do more stuff before death
  MESSAGE_HANDLER_DECLARATION(Die);
};

/////////////
// Interface class
class Adder : public EventProcessor {
 public:
  Adder(void);
};

inline Adder::Adder(void){
  evProc = new AdderImp();
}

#endif // _ADDER_H_
